package com.dataseek.iot.device.sample;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class TestStr {
    public static void main(String[] args) {
//        String url="http://127.0.0.1:28688/sys/~tenanta~/user/login";
//        int beginIndex = url.indexOf("~")+1;
//        int endIndex = url.lastIndexOf("~");
//        String tenantCode = url.substring(beginIndex,endIndex);
//        System.out.println();

        String str="\"";
        List<String>  sss=new ArrayList<>();
        sss.add("aaaaa");
        sss.add("bbbbb");
        sss.add("ddddddddd");
//        for (String ss:sss){
//            str=str+ss+"\",\"";
//        }
        String[] Properties={"1","2","3"};
        Map paramMp=new HashMap();
        paramMp.put("timestamp",System.currentTimeMillis());
        paramMp.put("messageId","11111111111");
        paramMp.put("deviceId","555");
        paramMp.put("properties",Properties);

        String message = JSONObject.toJSONString(paramMp, SerializerFeature.WriteMapNullValue);
        System.out.println(message);
    }
}
